package com.example.toolproject.demo.service.serviceimpl;

import com.example.toolproject.demo.mapper.UserScenicSportMapper;
import com.example.toolproject.demo.service.UserScenicSportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName UserScenicSportServiceImpl
 * @Description TODO
 * @Author lvyongwei
 * @Date 2020-06-28 10:35
 **/
@Service
public class UserScenicSportServiceImpl implements UserScenicSportService {

    @Autowired
    private UserScenicSportMapper userScenicSportMapper;

    /**
     * 用户选择景点插入关联表信息
     * @param scenicSportId
     * @param userId
     * @return
     */
    @Override
    public boolean insertUserScenicSport(int scenicSportId, int userId) {
        return userScenicSportMapper.insertUserScenicSport(scenicSportId,userId);
    }

    /**
     * 用户取消选择，删除关联表信息
     * @param scenicSportId   景点id
     * @param userId       用户id
     * @return
     */
    @Override
    public boolean deleteUserScenicSport(int scenicSportId, int userId) {
        return userScenicSportMapper.deleteUserScenicSport(scenicSportId, userId);
    }

    /**
     * 获取用户已经选择的景点的个数
     * @param userId
     * @return
     */
    @Override
    public int getChoiceCount(int userId) {
        return userScenicSportMapper.getChoiceCount(userId);
    }
}
